<?php
class Custom_View_Helper_Urlfor extends Zend_View_Helper_Abstract
{
    public function urlFor()
    {
        $arguments = func_get_args();

        if (!isset($arguments[0])) {
            throw new Custom_View_Exception('Url define mistake!');
        }

        list($route, $params) = Custom_Utility_Parse::urlToParameters($arguments[0]);
        $params['module'] = isset($arguments[1]) ? $arguments[1] :
            Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
        $reset      = isset($arguments[2]) ? $arguments[2] : true;
        $encode     = isset($arguments[3]) ? $arguments[3] : true;

        return $this->view->url($params, $route, $reset, $encode);
    }
}
?>